function submitFinForm(){
		var type = document.getElementById("finType").value;
		var random = document.getElementById("random").value; 
		var money = 0;    
	   	var finMoneyRadio=document.getElementsByName("finMoney");
	    if(finMoneyRadio!=null){
	        var i;
	        for(i=0;i<finMoneyRadio.length;i++){
	            if(finMoneyRadio[i].checked){
	            	money =  finMoneyRadio[i].value;
	            	if(document.getElementById("number6").checked){
	            		money = document.getElementById("diyMoney").value;
	            	}
	            }
	        }
	    }
	    if(money.toString().indexOf(".")!=-1){
	    	money = money.toString().split(".")[0];
	    	money = money+(random.substring(1));
	    }else{
	    	money = money+(random.substring(1));
	    }
	    if(money<1000 || isNaN(money)){
	    	okcoinAlert(minimum1000,"",null);
	    	return;
	    }
	    var bankID = -1;
	    var typeParam="";
	    if(type == 1){//支付宝网银
	    	var bankRadio=document.getElementsByName("bankID");
		    if(bankRadio!=null){
		        var i;
		        for(i=0;i<bankRadio.length;i++){
		            if(bankRadio[i].checked){
		            	bankID =  bankRadio[i].value;
		            }
		        }
		    }
		    if(bankID == -1){
		    	pleaseselectabank = get$("pleaseselectabank");
		    	okcoinAlert(pleaseselectabank,"",null);
		    	return;
		    }
		    typeParam = "&frp="+bankID;
	    }else if(type == 2 || type == 3 || type == 4 || type==6){//支付宝手动
	    	var url = "/account/alipayManual.do?random="+Math.round(Math.random()*100);
	    	var param={money:money,type:type};
	    	jQuery.post(url,param,function(data){
	    		var result = eval('(' + data + ')');
	    		if(result!=null){
	    			if(result == -100051){
	    				okcoinAlert(minimum1000,"",null);
	    			}else if(result == -100052){
	    				okcoinAlert(thedepositinvalid,"",null);
	    			}
	    			if(type == 2){
	    				document.getElementById("tips1").innerHTML="1. 登录您的财付通，进入'转账'。";
	    				document.getElementById("tips2").innerHTML="2. 按照下表填写“我要付款”表单：";
	    				document.getElementById("tips3").innerHTML="3. 输入“校验码”并点击“下一步”付款。";
	    				document.getElementById("tips2title").innerHTML="财付通";
	    				document.getElementById("tips2ul").style.display="";
	    				document.getElementById("tipsTenpay").style.display="";
	    		    	document.getElementById("tipsAlipay").style.display="none";
	    		    	document.getElementById("tips2bank").style.display="none";
	    		    	document.getElementById("tips6ul").style.display="none";
	    			}else if(type == 3){
	    				document.getElementById("tips1").innerHTML="1. 登录您的支付宝，进入'我要付款'。";
	    				document.getElementById("tips2").innerHTML="2. 按照下表填写“我要付款”表单：";
	    				document.getElementById("tips3").innerHTML="3. 输入“校验码”并点击“下一步”付款。";
	    				document.getElementById("tips2title").innerHTML="支付宝";
	    				document.getElementById("tips2ul").style.display="";
	    				document.getElementById("tipsTenpay").style.display="none";
	    		    	document.getElementById("tipsAlipay").style.display="";
	    		    	document.getElementById("tips2bank").style.display="none";
	    		    	document.getElementById("tips6ul").style.display="none";
	    			}else  if(type == 4){
	    				document.getElementById("tips1").innerHTML="1. 登录您的银行网银，选择转账汇款，或者去银行柜台，要求转账汇款。";
	    				document.getElementById("tips2").innerHTML="2. 按照下表填写银行汇款信息表单：";
	    				document.getElementById("tips3").innerHTML="3. 完成汇款之后,请点击“下一步”，提交您的汇款信息，或者在充值记录里“补全信息”。";
	    				document.getElementById("tips2ul").style.display="none";
	    				document.getElementById("alipayhandDiv").style.display="";
//	    				document.getElementById("tipsTenpay").style.display="none";
//	    		    	document.getElementById("tipsAlipay").style.display="none";
//	    		    	document.getElementById("tips6ul").style.display="none";
	    				document.getElementById("specificStepBackground").className = "specificStepBackground2";
	    				
	    		    	
	    		    	document.getElementById("bankMoney").innerHTML = result.money;
	    		    	document.getElementById("subMoney").innerHTML = result.money;
	    		    	document.getElementById("bankInfo").innerHTML = result.tradeId;
	    		    	document.getElementById("desc").innerHTML = result.tradeId;
	    		    	
	    		    	document.getElementById("alipayhandDiv").style.display="";
	    		    	document.getElementById("finButton").style.display="none";
	    		    	document.getElementById("moneyDiv").style.display="none";
	    		    	
	    		    	refTenbody(type);
	    		    	
	    			}else if(type == 6){
	    				document.getElementById("tips1").innerHTML="1. <a target='_blank' href=' http://item.taobao.com/item.htm?spm=a230r.1.14.19.rESicv&id=26790916474&initiative_new=1'>访问OKCoin官方淘宝店。</a>";
	    				document.getElementById("tips2").innerHTML="2. 拍下相应金额的宝贝，比如充值"+money+"元，请拍"+money+"件一元宝贝,按照下表填写表单：";
	    				document.getElementById("tips3").innerHTML="3. 提交完订单以后，请联系网站客服进行发货。";
	    				document.getElementById("payResultTips").innerHTML="确认收货后";
	    				document.getElementById("tips2ul").style.display="none";
	    				document.getElementById("tips2bank").style.display="none";
	    				document.getElementById("tipsTenpay").style.display="none";
	    		    	document.getElementById("tipsAlipay").style.display="none";
	    		    	document.getElementById("tips6ul").style.display="";
	    		    	document.getElementById("taobaoTips4").style.display="";
	    			}
//	    			if(type != 6){
//	    				document.getElementById("payResultTips").innerHTML="付款完成后";
//	    				document.getElementById("taobaoTips4").style.display="none";
//	    			}
//	    			if(type==2 || type == 3){
//	    				document.getElementById("alipayManualMoney").innerHTML=result.money+"元";
//		    			document.getElementById("alipayManualInfo").innerHTML=result.tradeId+","+result.userId;
//	    			}else if(type == 6){
//	    				document.getElementById("taobaoMoney").innerHTML=result.money+"件";
//		    			document.getElementById("taobaoInfo").innerHTML=result.tradeId+","+result.userId;
//	    			}else{
//	    				document.getElementById("bankMoney").innerHTML=result.money+"元";
//		    			document.getElementById("bankInfo").innerHTML=result.tradeId+","+result.userId;
//	    			}
	    			
	    		}
	    	});
	    	
	    	return;
	    }

	    document.getElementById("finTipsDiv").style.display="";
		dialogBoxShadow();
		
		var finButton = document.getElementById("finButton");
		finButton.target="_blank" ;
		finButton.href = "/account/pay/jump.do?type="+type+"&money=" + money+typeParam;  
	}
function rechargeto(id){
	document.getElementById("finTipsDiv").style.display="";
	dialogBoxShadow();
	var key = document.getElementById("returnKey").value;
	var payurl = document.getElementById("payUrl").value;
	var finButton = document.getElementById(id);
	finButton.target="_blank" ;
	finButton.href = payurl+"/payto.do?key="+key; 
}

function closeFinTipsDiv(){
	dialogBoxHidden();
	document.getElementById("finTipsDiv").style.display="none";
}


function showDiyMoney(type){
	if(type ==6){
		document.getElementById("diyMoney").style.display="";
		document.getElementById("randomSpan").style.display="";
	}else{
		document.getElementById("diyMoney").style.display="none";
		document.getElementById("randomSpan").style.display="none";
	}
}
function clearDiyMoney(){
	var diyMoney = document.getElementById("diyMoney").value;
	if(pleaseentertheamount == diyMoney){
		document.getElementById("diyMoney").value = "";
	}
}

function changebank(id){
	jQuery("#banks").find("label").each(function() {
		jQuery(this).removeClass(" current");
	});
		jQuery("#label_" + id).addClass(" current");
}
var bankId = document.getElementsByName("bankID");
for(var i = 0;i < bankId.length;i++){
	bankId[i].onclick=function(){
	changebank(this.id);
	};
}

function moreBanks(){
	document.getElementById("li_Bank12").style.display="";
	//document.getElementById("li_Bank13").style.display="";
//	document.getElementById("li_Bank14").style.display="";
	document.getElementById("li_Bank15").style.display="";
	document.getElementById("li_Bank16").style.display="";
	//document.getElementById("li_Bank17").style.display="";
	//document.getElementById("li_Bank18").style.display="";
	document.getElementById("li_Bank19").style.display="";
	//document.getElementById("li_Bank20").style.display="";
	document.getElementById("moreBanks").style.display="none";
}

/**
 * 文本输入框验证只让输入数字--充值金额的验证
 */
function validateInputNumber(inputId){
	var inputStr = document.getElementById(inputId).value;
	for(var i=0; i<inputStr.length; i++){
		var temp = inputStr.charAt(i);
		if((temp > "9" || temp < "0") && temp != "."){
			document.getElementById(inputId).value = "";
			return false;
		}
		//第一个字符只能输入1到9
		if(i == 0){
			if(temp > "9" || temp < "1"){
				document.getElementById(inputId).value = "";
				return false;
			}
		}
	}
    if(inputStr.indexOf(".")>=0) {
        var temp = inputStr.split(".");
        if(temp[temp.length-1].length>2) {
            document.getElementById(inputId).value = "";
            return false;
        }
    }
}

/**
 * 支付宝人工操作 返回修改金额
 */
function backModifyMoney(){
	document.getElementById("alipayhandDiv").style.display="none";
	document.getElementById("finButton").style.display="";
	document.getElementById("moneyDiv").style.display="";
	document.getElementById("specificStepBackground").className = "specificStepBackground1";
}

function submitPaymentInformation(){
	if(confirm(areyousureremittedus)){
		document.getElementById("alipayhandDiv").style.display="none";
		document.getElementById("blankRemittance").style.display="";
		document.getElementById("specificStepBackground").className = "specificStepBackground3";
	}
}

function submitTransferAccounts(){
	
	var bank = document.getElementById("fromBank").value;
	var account = document.getElementById("fromAccount").value;
	var payee = document.getElementById("fromPayee").value;
	var phone = document.getElementById("fromPhone").value;
	
	var obj =document.getElementsByName("fromType");
	var type = "";
	for(var i=0;i<obj.length;i++){
	    if(obj.item(i).checked){
	    	type=obj.item(i).getAttribute("value");  
	        break;
	     }else{
	    	 continue;
	  }
	}
	var desc = document.getElementById("desc").innerHTML;
	if(bank == "" || account == "" || payee == "" || phone== "" || type == "" || desc ==""){
		okcoinAlert(completeinformation,"",null);
    	return;
	}
	var url = "/account/rechargeCnySubmit.do?random="+Math.round(Math.random()*100);
	var param={bank:bank,account:account,payee:payee,phone:phone,type:type,desc:desc};
	jQuery.post(url,param,function(data){
		var result = eval('(' + data + ')');
		if(result!=null){
			if(result == -2){
				okcoinAlert(completeinformation,"",null);
			}else if(result == 0){
				document.getElementById("blankRemittance").style.display = "none";
				document.getElementById("TransferAccountsComplete").style.display = "block";
				document.getElementById("riskArea4").style.display = "";
				refTenbody(type);
				document.getElementById("specificStepBackground").className = "specificStepBackground4";
			}else if(result == -3){
				okcoinAlert(remarkbeenused,"",null);
			}
		}
	});
}

function updateFinTransactionReceive(fid,money){
	document.getElementById("subMoney").innerHTML = money;
	document.getElementById("desc").innerHTML = fid;
	document.getElementById("finButton").style.display="none";
	document.getElementById("moneyDiv").style.display="none";
	document.getElementById("alipayhandDiv").style.display="none";
	document.getElementById("blankRemittance").style.display="";
	document.getElementById("TransferAccountsComplete").style.display="none";
	document.getElementById("specificStepBackground").className = "specificStepBackground3";
}
function refreshOrdersFin(val,obj,type){
	jQuery(obj).parent().addClass("cur");
	if(val==0){
		jQuery("#orders2li").removeClass("cur");
	}else{
		jQuery("#orders1li").removeClass("cur");
	}
	jQuery("#refreshOrdersValue").val(val);
	refTenbody(type);
}

function refTenbody(type){
	var orders = jQuery("#refreshOrdersValue").val();
	var currentPage = jQuery("#currentPage").val();
	var url = "/account/refTenbody.do?currentPage="+currentPage+"&orders="+orders+"&type="+type+"&random="+Math.round(Math.random()*100);
	jQuery("#Tenbody").load(url,null,function (data){
	});
}

function showHelpTisBlock(){
	jQuery("#rechargeCnyBlock").hide();
	jQuery("#rechargeCnyHelpBlock").show();
}

function showHelpTisPhoneBlock(){
	jQuery("#bankRemittanceInfo").hide();
	jQuery("#phoneTransferHelp").show();
}

function hideHelpTisPhoneBlock(){
	jQuery("#bankRemittanceInfo").show();
	jQuery("#phoneTransferHelp").hide();
}

function showHelpTisWebBankBlock(){
	jQuery("#bankRemittanceInfo").hide();
	jQuery("#webBankTransferHelp").show();
}

function hideHelpTisWebBankBlock(){
	jQuery("#bankRemittanceInfo").show();
	jQuery("#webBankTransferHelp").hide();
}

function showCreateOrder(){
	jQuery("#rechargeCnyBlock").show();
	jQuery("#rechargeCnyHelpBlock").hide();
}

function createOrderTips(){
	var money = document.getElementById("subMoney").value;
	var phone = document.getElementById("fromPhone").value;
	if(phone== "" || money=="" ){
		//okcoinAlert("请填写完整信息！","",null);
		document.getElementById("finTigs").innerHTML = completeinformation;
		return;
	}
	jQuery("#rechargeCnyHelpBlock").show();
	dialogBoxShadow();
}

function createOrder(showType){
	if(showType==null){
		showType=1;
	}
	var type = document.getElementById("finType").value;
	var random = document.getElementById("random").value;
	var money = 0;
	
	var addressId = jQuery("#bankBindedSel").attr("addressValue");
    
    if(addressId <= 0){
    	document.getElementById("finTigs").innerHTML = get$("pleaseselectbankaccount");
    	return;
    }
    
    money = document.getElementById("subMoney").value;

	var phone = document.getElementById("fromPhone").value;
	
	if(phone== "" || money=="" ){
		//okcoinAlert("请填写完整信息！","",null);
		document.getElementById("finTigs").innerHTML = completeinformation;
    	return;
	}
    var ischinaphone = jQuery("#ischinaphone").attr("checked")=="checked";
    //if((!checkMobile(phone)&&ischinaphone)||(!/^\d{6,11}$/.test(phone)&&!ischinaphone)) {
    //    document.getElementById("finTigs").innerHTML = get$("inputrightphonenumber");
    //    return;
    //}else {
    //    document.getElementById("finTigs").innerHTML = "&nbsp;";
    //}
    if(money.toString().indexOf(".")!=-1){
    	money = money.toString().split(".")[0];
    	money = money+(random.substring(1));
    }else{
    	money = money+(random.substring(1));
    }
    if(money<100 || isNaN(money)){
    	document.getElementById("finTigs").innerHTML=minimum1000;
    	return;
    }else if(money>99999999){
    	document.getElementById("finTigs").innerHTML=get$("maxrechargeamount");
    	return;
    }
    var url = "/account/alipayManual.do?random="+Math.round(Math.random()*100);
	var param={addressId:addressId,phone:phone,money:money,type:type};
	jQuery.post(url,param,function(data){
        var resultDate = eval('(' + data + ')');
        var result = -1;
		if(resultDate!=null){
            result = resultDate.result;

			if(result == -100053){
				//okcoinAlert(completeinformation,"",null);
				document.getElementById("finTigs").innerHTML=completeinformation;
			}else if(result == 0){
                var desc = resultDate.desc;// 备注
                var finTransactionId = resultDate.finTransactionId;
                var bankName = "其它银行", bankUrl = "", bankId = 0;
                if(resultDate.bankCode!=null) {
                    bankName = resultDate.bankCode.name;
                    bankUrl = resultDate.bankCode.url;
                    bankId = resultDate.bankCode.id;
                }

				document.getElementById("inPrice").innerHTML = money;
				document.getElementById("inTruePrice").innerHTML = money;
				document.getElementById("bankUrl").value= bankUrl;
//				if(fromType==0){
					document.getElementById("toBtn").style.display="";
					document.getElementById("closeBtn").style.display="none";
					
					document.getElementById("finishBtn").style.display="none";
					document.getElementById("toBank").value=go+bankName+forremitting;
                    if(bankId!=3&&money>=5000) {
                        document.getElementById("morethan5w").style.display="block";
                    }
//				}else{
//					document.getElementById("toBtn").style.display="none";
//					document.getElementById("finishBtn").style.display="";
//				}
				jQuery("#rechargeCnyHelpBlock").hide();
				jQuery("#bank_cny_pop_title").html("汇款单");
				jQuery("#bank_cny_pop_tips").show();
				//rechargeCnyBlock(bankID,showType);
				rechargeCnyBlock(finTransactionId,showType);
				refTenbody(type);
				document.getElementById("subMoney").value = "";
                //document.getElementById("fromAccount").value = "";
			}else if(result == -100054){
				//okcoinAlert(remarkbeenused,"",null);
				document.getElementById("finTigs").innerHTML=remarkbeenused;
			}else if(result == -100055){
                document.getElementById("finTigs").innerHTML=get$("companyrechargeaccountinvalid");
            }else if(result == -100056){
                document.getElementById("finTigs").innerHTML=get$("rechargecountrylimit");
            }
		}
	});
	
}

function getBankInfo(bankid){
	var bankname = "";
	var bankurl = "";
	if(bankid == 5){
		bankname = "农业银行";
		bankurl = "http://www.95599.cn/cn/wydl/grwydl/";
	}else if(bankid == 1){
		bankname = "中国银行";
		bankurl = "http://www.boc.cn/";
	}else if(bankid == 4){
		bankname = "建设银行";
		bankurl = "http://www.ccb.com/cn/home/index.html";
	}else if(bankid == 2){
		bankname = "工商银行";
		bankurl = "http://www.icbc.com.cn/icbc/";
	}else if(bankid == 19){
		bankname = "中国邮政储蓄银行";
		bankurl = "http://www.psbc.com/portal/zh_CN/index.html";
	}else if(bankid == 3){
		bankname = "招商银行";
		bankurl = "http://www.cmbchina.com/";
	}else if(bankid == 10){
		bankname = "交通银行";
		bankurl = "http://www.bankcomm.com/";
	}else if(bankid == 9){
		bankname = "民生银行";
		bankurl = "http://www.cmbc.com.cn/";
	}else if(bankid == 11){
		bankname = "中信银行";
		bankurl = "http://bank.ecitic.com/";
	}else if(bankid ==13){
		bankname = "光大银行";
		bankurl = "http://ebank.cebbank.com/";
	}else if(bankid == 8){
		bankname = "广发银行";
		bankurl = "http://www.cgbchina.com.cn/";
	}else if(bankid ==16){
		bankname = "平安银行";
		bankurl = "http://bank.pingan.com/index.shtml";
	}else if(bankid == 20){
		bankname = "深圳发展银行";
		bankurl = "http://bank.pingan.com/index.shtml";
	}else if(bankid == 6){
		bankname = "浦发银行";
		bankurl = "http://ebank.spdb.com.cn/";
	}else if(bankid == 7){
		bankname = "兴业银行";
		bankurl = "http://www.cib.com.cn/netbank/cn/index.html";
	}else if(bankid == 21){
		bankname = "北京银行";
		bankurl = "http://www.bankofbeijing.com.cn/";
	}else if(bankid == 22){
		bankname = "南京银行";
		bankurl = "http://www.njcb.com.cn/";
	}else if(bankid ==15){
		bankname = "宁波银行";
		bankurl = "http://www.nbcb.com.cn/";
	}else if(bankid == 23){
		bankname = "上海农商银行";
		bankurl = "http://www.srcb.com/html/index.html";
	}else if(bankid ==24){
		bankname = "东亚银行";
		bankurl = "http://www.hkbea.com.cn/";
	}else{
		bankname = "其他银行";
		bankurl = "";
	}
	return bankname+"&"+bankurl;
}

function rechargeCnyBlock(finId,showType){

    document.getElementById("rechargeCnyBlock").style.display="";

    var url = "/account/rechargeCnyBlock.do?random="+Math.round(Math.random()*100);
    var param={finId:finId};
    jQuery.post(url,param,function(data){
        var resultDate = eval('(' + data + ')');

        var bankaddr = "";
        var bankNo = "";
        var bankName = "";
        var desc = "";
        if(resultDate!=null){
            var result = resultDate.result;

            if(result==0){
                bankaddr = resultDate.CompanyAccountBankAddr;
                bankNo = resultDate.CompanyAccountBankNo;
                bankName = resultDate.CompanyAccountBankName;
                desc = resultDate.desc;
            }
        }

        document.getElementById("inDesc").innerHTML=desc;
        document.getElementById("inDesc2").innerHTML=desc;
        jQuery("#inBank").html(bankaddr);
        jQuery("#inAccount").html(bankNo);
        jQuery("#inPeeName").html(bankName);
        dialogBoxShadow();

    });
}
function closerechargeCnyBlock(id){
	dialogBoxHidden();
	document.getElementById("rechargeCnyBlock").style.display="none";
}
function toBank(){
	var url = document.getElementById("bankUrl").value;
	var finButton = document.getElementById("jumpBtn");
	finButton.target="_blank" ;
	finButton.href = url; 
	finButton.click();
	document.getElementById("toBtn").style.display="none";
	document.getElementById("closeBtn").style.display="";
	document.getElementById("finishBtn").style.display="";
}
function toPhone(){
	document.getElementById("toBtn").style.display="none";
	document.getElementById("closeBtn").style.display="";
	document.getElementById("finishBtn").style.display="";
	jQuery(".phoneChargeTips").show();
}
function finishOrder(){
	window.location.href="/account/rechargeCny.do?type=4&random="+Math.round(Math.random()*100);
}
function viewFinTransaction(money,data) {
	var errorMoney = parseInt(money);
    document.getElementById("inPrice").innerHTML=money;
    document.getElementById("inTruePrice").innerHTML=money;
//    document.getElementById("inErrorPrice").innerHTML=errorMoney;
//    document.getElementById("inDesc").innerHTML=data;
//    document.getElementById("inDesc2").innerHTML=data;
    document.getElementById("toBtn").style.display="none";
    document.getElementById("finishBtn").style.display="none";

    var finId = jQuery("#finId"+data).text();
    rechargeCnyBlock(finId,1);
}

function showChargeCodeblock(tid){
	document.getElementById("bankRechargeBlock").style.display="";
	dialogBoxShadow();
    var bkinfo = getBankInfo(tid);
    bankID = bkinfo.toString().split("&")[0];
	var ur = bkinfo.toString().split("&")[1];
	document.getElementById("bankUrlNew").value= ur;
	document.getElementById("toBankNew").value=go+bankID+forremitting;
	document.getElementById("toBtnNew").style.display="";
	document.getElementById("finishBtnNew").style.display="none";
	addMoveEvent("bankRecharge_title","bankRecharge_content");
}

function closeChargeCodeblock(){
	document.getElementById("bankRechargeBlock").style.display="none";
	dialogBoxHidden();
}

function toBankNew(){
	var url = document.getElementById("bankUrlNew").value;
	var finButton = document.getElementById("jumpBtnNew");
	finButton.target="_blank" ;
	finButton.href = url; 
	finButton.click();
	document.getElementById("toBtnNew").style.display="none";
	document.getElementById("closeBtnNew").style.display="";
	document.getElementById("finishBtnNew").style.display="";
}

/**
 * 银行卡充值提交
 */
function rechargeCnyConfirm(){
    var paymentAmount = document.getElementById("paymentAmount").value;
    var bank = jQuery("input[name=bankID]:checked");
    var agentId = 0;
    if(bank&&bank.val()&&bank.val()!="") {
        agentId = bank.val();
    }
    if(agentId == 0) {
        document.getElementById("errorprompt").innerHTML=get$("bankrecharge1");
        return;
    }
    if(paymentAmount == ""){
        document.getElementById("errorprompt").innerHTML=rechargeusdamount;
        return;
    }
    if(paymentAmount<100||paymentAmount>1000000) {
        document.getElementById("errorprompt").innerHTML=get$("bankrecharge2");
        return;
    }
    var url = "/account/rechargeCnyConfirm.do?random="+Math.round(Math.random()*100);
    var param={agentId:agentId,paymentAmount:paymentAmount,bankName:bank.attr("bankname")};
    jQuery.ajax({
        type : "post",
        url : url,
        data : param,
        async : false,
        success : function(data){
            var result = eval('(' + data + ')');
            if(result!=null){
                if(result.code == 0){
                    okcoinAlert(get$("bankrecharge3")+"<br>"+get$("bankrecharge6"),"",null);
                    //提交成功并刷新最近20笔交易
                    jQuery("input[name=bankID]").attr("checked",false);
                    jQuery("#paymentAmount").val("");
                    document.getElementById("errorprompt").innerHTML="";
                    rechargeCnyRecord();
                }else if(result.code == 10){
                    okcoinAlert(get$("bankrecharge3")+"<br>"+get$("bankrecharge6")+"<br>"+get$("bankrecharge5"),"",null);
                    //提交成功并刷新最近20笔交易
                    jQuery("input[name=bankID]").attr("checked",false);
                    jQuery("#paymentAmount").val("");
                    document.getElementById("errorprompt").innerHTML="";
                    rechargeCnyRecord();
                }else if(result == 1){
                    okcoinAlert(rechargeusdsubfailure,"",null);
                }else if(result == -1){
                    document.getElementById("errorprompt").innerHTML=rechargeusdillegal;
                }else if(result == -2){
                    document.getElementById("errorprompt").innerHTML=rechargeusdamount;
                }else if(result == -3){
                    document.getElementById("errorprompt").innerHTML=rechargeusdcertificate;
                }else if(result == -4){
                    document.getElementById("errorprompt").innerHTML=get$("bankrecharge2");
                }else if(result == -5){
                    document.getElementById("errorprompt").innerHTML=get$("bankrecharge4");
                }else if(result == -6){
                    document.getElementById("errorprompt").innerHTML=get$("bankrecharge1");
                }
            }
        }
    });
}

/**
 * 充值记录
 */
function rechargeCnyRecord(){
    var url = "/account/rechargeUsdRecord.do?random="+Math.round(Math.random()*100);
    jQuery("#rechargeCnyRecordDiv").load(url,null,function (data){});
}

function rechargeamountFocus(){
    var banknumber = document.getElementById("fromAccount").value;
    document.getElementById("displayBankNumber").innerHTML = banknumber;
    if(bankaccountnumber == banknumber){
        document.getElementById("fromAccount").value = "";
    }
    document.getElementById("displayBankNumber").style.display="";
}

function rechargeamountBlur(){
    var banknumber = document.getElementById("displayBankNumber").innerHTML;
    document.getElementById("fromAccount").value = banknumber;
    document.getElementById("displayBankNumber").style.display="none";
    if(banknumber == ""){
        document.getElementById("fromAccount").value = bankaccountnumber;
    }
}

function rechargeamountKeyup(){
    var banknumber = document.getElementById("fromAccount").value;
    banknumber = banknumber.replace(new RegExp(" ","gm"),'');
    banknumber = plusSpace(banknumber);
    document.getElementById("displayBankNumber").innerHTML = banknumber;
    document.getElementById("fromAccount").value = banknumber;
}

function plusSpace(banknumber){
    var length = banknumber.length;
    var newbanknumber = "";
    if(length > 4){
        var size = parseInt(length/4);
        for (var i = 0; i < size; i++) {
            var start = i*4;
            var end = (i+1)*4;
            if((i+1)*4 > length){
                end = length;
            }
            var str = banknumber.substring(start,end);
            newbanknumber += str+" ";
        };
        if(length%4 != 0){
            newbanknumber += banknumber.substring(size*4,length);
        }else{
            var endstr = newbanknumber.substring(newbanknumber.length-1,newbanknumber.length);
            if(endstr == " "){
                newbanknumber = newbanknumber.substring(0,newbanknumber.length-1);
            }
        }
    }else{
        return banknumber;
    }
    return newbanknumber;
}

function showAlipayRechargeblock(id_prefix,type){
	showTips("");
	document.getElementById(id_prefix).style.display="";
	var div_1 = document.getElementById("alipay_div_1");
	var div_2 = document.getElementById("alipay_div_2");
	var div_3 = document.getElementById("alipay_div_3");

	if(div_2){
		div_2.style.display="none";
	}
	if(div_3){
		div_3.style.display="none";
	}
	if(type!=3 && !div_1){
		div_1.style.display="";
	}
	if(type==3){
		if(div_1){
			div_1.style.display="none";
		}
		document.getElementById("pop_title").innerHTML = get$("alipayrecharge12");
		document.getElementById("alipayRecharge_content").style.width="680px";
		document.getElementById("alipayRecharge_content").style.left="55%";
		document.getElementById("alipayRecharge_content").style.top="35%";
	}else {
		document.getElementById("pop_title").innerHTML = get$("alipayrecharge13");
		document.getElementById("alipayRecharge_content").style.width="496px";
		document.getElementById("alipayRecharge_content").style.left="55%";
		document.getElementById("alipayRecharge_content").style.top="35%";
	}
	dialogBoxShadow();
	document.getElementById("alipay_div_"+type).style.display="";
	addMoveEvent(id_prefix+"_title",id_prefix+"_content");
}
function showDiv(type){
	showTips("");
	var div_1 = document.getElementById("alipay_div_1");
	var div_2 = document.getElementById("alipay_div_2");
	var div_3 = document.getElementById("alipay_div_3");
	if(div_2){
		div_2.style.display="none";
	}
	if(div_3){
		div_3.style.display="none";
	}
	if(type!=3 && !div_1){
		div_1.style.display="";
	}
	if(type==3){
		div_1.style.display="none";
		document.getElementById("pop_title").innerHTML = get$("alipayrecharge12");
		document.getElementById("alipayRecharge_content").style.width="680px";
		document.getElementById("alipayRecharge_content").style.left="55%";
		document.getElementById("alipayRecharge_content").style.top="35%";
	}else {
		document.getElementById("pop_title").innerHTML = get$("alipayrecharge13");
		document.getElementById("alipayRecharge_content").style.width="496px";
		document.getElementById("alipayRecharge_content").style.left="55%";
		document.getElementById("alipayRecharge_content").style.top="35%";
	}
	document.getElementById("alipay_div_"+type).style.display="";
}
function closeAlipayRechargeblock(id_prefix){
	document.getElementById(id_prefix).style.display="none";
	dialogBoxHidden();
	if(document.getElementById("pop_title").innerHTML == get$("alipayrecharge12"))
		window.location.href="/account/rechargeCny.do?type=12&random="+Math.round(Math.random()*100);
}
function addNewAccount(){
	var account = document.getElementById("new_account").value;
	account = trim(account);
	var url = "/account/bindAlipay.do";
	var params = {"account":account};
	if(!checkEmail(account) && !checkMobile(account)){
		showTips(get$("alipayrecharge2"));
		return;
	}
	jQuery.post(url,params,function(data){
		if(data == 0){
			document.getElementById("new_account").value = "";
			showTips(get$("alipayrecharge14"),1000);
		}else if(data == -1){
			window.location.href = "/";
		}else if(data == -2){
			showTips(get$("alipayrecharge7"));
		}else if(data == -3 || data == -4){
			showTips(get$("alipayrecharge8"));
		}else if(data == -5){
			showTips(get$("alipayrecharge9"));
		}else if(data == -6){
			showTips(account + get$("alipayrecharge5"));
		}else if(data == -7 || data == -8){
			showTips(get$("alipayrecharge10"));
		}else if(data == -9){
			showTips(get$("alipayrecharge11"));
		}else if(data == -10){
			showTips(get$("alipayrecharge2"));
		}
	},"html")
}
function showTips(msg,time_delay){
	document.getElementById("error_tips").innerHTML = msg;
	if(!!time_delay && time_delay > 0){
		window.setTimeout(function(){
			location.reload();
		},time_delay);
	}

}
function cancelAddNewAccount(){
	document.getElementById("new_account").value = "";
	closeAlipayRechargeblock('alipayRecharge');
}

function changeAccount(account){
	document.getElementById("selected_account").value = account;
	document.getElementById("selected_account_text").innerHTML = account;
	closeAlipayRechargeblock('alipayRecharge');
}

function createAlipayOrder(){
	var pre_url = document.getElementById("img_pre_url").value;
	var type = document.getElementById("finType").value;
	var random = document.getElementById("random").value;
	var money = document.getElementById("alipay_money").value;

	var accountInput = document.getElementById("selected_account");
    var account = "";
    var phoneAccount = "";
    if(accountInput){
        account = accountInput.value;
    }else{
        account = document.getElementById("new_account").value;
        phoneAccount = document.getElementById("new_account_phone").value;
        if(account=="" && phoneAccount ==""){
            document.getElementById("alipay_error_tips").innerHTML = "支付宝账号邮箱或手机必需填写至少一项";
            return;
        }else if(!checkEmail(account) && !checkMobile(phoneAccount)){
            document.getElementById("alipay_error_tips").innerHTML = get$("alipayrecharge2");
            return;
        }
    }
	if(money=="" ){
		document.getElementById("alipay_error_tips").innerHTML = "请输入充值金额";
		return;
	}else {
		document.getElementById("alipay_error_tips").innerHTML = "&nbsp;";
	}
	if(money<100 || isNaN(money)){
		document.getElementById("alipay_error_tips").innerHTML=minimum1000;
		return;
	}
	if(money > 5000){
		document.getElementById("alipay_error_tips").innerHTML= get$("alipayrecharge3");
		return;
	}
	if(money.toString().indexOf(".")!=-1){
		money = money.toString().split(".")[0];
		money = money+(random.substring(1));
	}else{
		money = money+(random.substring(1));
	}

	var url = "/account/alipayRechargePre.do?random="+Math.round(Math.random()*100);
	var param={account:account,phoneAccount:phoneAccount,money:money,type:type};
	jQuery.post(url,param,function(data){
		var resultCode = data.result_code;
        if(resultCode == -1){
            document.getElementById("alipay_error_tips").innerHTML="充值金额小于100";
        }else if(resultCode == -2){
            okcoinAlert("充值金额不正确","",null);
        }else if(resultCode > 0){
            if(data.alipay_qr_account=="" || data.alipay_qr_account==null) {
                // 未获得支付宝充值目标账号
				document.getElementById("alipay_error_tips").innerHTML=get$("alipayrecharge15");
				//okcoinAlert(get$("alipayrecharge15"), "", null);
            }else{
                document.getElementById("alipay_money").value = "";
                document.getElementById("pay_amount").innerHTML = money;
                showAlipayRechargeblock('alipayRecharge',3);
                showTips(get$("alipayrecharge4"));
                document.getElementById("qr_code_pop_alipay").setAttribute("src",data.alipay_qr_path);
                document.getElementById("span_alipay_account").innerHTML = data.alipay_qr_account;
                document.getElementById("span_alipay_account_name").innerHTML = data.alipay_qr_account_name;
            }
            refTenbody(type);
		}else if(resultCode == -3){
			okcoinAlert(remarkbeenused,"",null);
		}else if(resultCode == -4){
            document.getElementById("alipay_error_tips").innerHTML="邮箱格式不正确";
        }else if(resultCode == -5){
            window.location.href = "/";
        }else if(resultCode == -6){
            document.getElementById("alipay_error_tips").innerHTML="手机号格式不正确";
        }else if(resultCode == -100056){
			okcoinAlert(get$("rechargecountrylimit"),"",null);
		}else if(resultCode == -10106){
            document.getElementById("alipay_error_tips").innerHTML="手机支付宝账户已经被绑定";
        }else if(resultCode<-100){
            resultCode = resultCode+100;
            if(resultCode == -1){
                window.location.href = "/";
            }else if(resultCode == -2){
                okcoinAlert(get$("alipayrecharge7"),"",null);
            }else if(resultCode == -3 || resultCode == -4){
                okcoinAlert(get$("alipayrecharge8"),"",null);
            }else if(resultCode == -5){
                okcoinAlert(get$("alipayrecharge9"),"",null);
            }else if(resultCode == -6){
                //okcoinAlert(account + get$("alipayrecharge5"),"",null);
				document.getElementById("alipay_error_tips").innerHTML=account + get$("alipayrecharge5");
			}else if(resultCode == -7 || resultCode == -8){
                okcoinAlert(get$("alipayrecharge10"),"",null);
            }else if(resultCode == -9){
                okcoinAlert(get$("alipayrecharge11"),"",null);
            }else if(resultCode == -10){
                okcoinAlert(get$("alipayrecharge2"),"",null);
            }else{
                okcoinAlert(get$("alipayrecharge6"),"",null);
            }
        }
	},"json");

}

function createAlipayOrderUnVerify(){
    //时间控件
    validDateIpt("#birthDate");

    //姓
    var realName = document.getElementById("realName").value;
    if(realName == ""){
        document.getElementById("alipay_error_tips").innerHTML = get$("notEmptyRealName");//真是姓名
        return;
    }
    if(realName.length >= 100){
        document.getElementById("alipay_error_tips").innerHTML = "姓名过长.";//get$("foreignIdentityfirstnameislong");
        return;
    }

    //国籍
    var country = document.getElementById("country").value;
    //出生日期
    var birthDate = document.getElementById("birthDate").value;
    //地点
    var verifyType = 0;
    if(document.getElementById("personalVerifyPosition")){
        verifyType  = document.getElementById("personalVerifyPosition").value;
    }

    if(country=="40"){//国内用户
        //身份证号
        var idNumber = trim(document.getElementById("idNumber").value);
        if(idNumber == ""){
            document.getElementById("alipay_error_tips").innerHTML = get$("notEmptyIdNumber");
            return;
        }else{
            document.getElementById("alipay_error_tips").innerHTML = "&nbsp;";
        }
        if(idNumber.length <= 5){
            document.getElementById("alipay_error_tips").innerHTML = get$("wrongidnumber");
            return;
        }
        if(idNumber.length >= 20){
            document.getElementById("alipay_error_tips").innerHTML = get$("wrongidnumber");
            return;
        }
        if(!identityCheck(idNumber)){
            document.getElementById("alipay_error_tips").innerHTML = get$("wrongidnumber");
            return;
        }
    }else{
        //护照号
        var passport = trim(document.getElementById("passport").value);
        if(passport == ""){
            document.getElementById("alipay_error_tips").innerHTML = get$("entryPassportNum");
            return;
        }else{
            document.getElementById("alipay_error_tips").innerHTML = "&nbsp;";
        }
        if(passport.length <= 5){
            document.getElementById("alipay_error_tips").innerHTML = get$("wrongpassportnumber");
            return;
        }
        if(passport.length >= 20){
            document.getElementById("alipay_error_tips").innerHTML = get$("wrongpassportnumber");
            return;
        }
        // 身份证用户不用选择生日，护照用户需要
        if(birthDate == ""){
            document.getElementById("alipay_error_tips").innerHTML = get$("notEmptyBirthday");
            return;
        }
    }
    
    var pre_url = document.getElementById("img_pre_url").value;
    var type = document.getElementById("finType").value;
    var random = document.getElementById("random").value;
    var money = document.getElementById("alipay_money").value;

    var accountInput = document.getElementById("selected_account");
    var account = "";
    var phoneAccount = "";
    if(accountInput){
        account = accountInput.value;
    }else{
        account = document.getElementById("new_account").value;
        phoneAccount = document.getElementById("new_account_phone").value;
        if(account=="" && phoneAccount ==""){
            document.getElementById("alipay_error_tips").innerHTML = "支付宝账号邮箱或手机必需填写至少一项";
            return;
        }else if(!checkEmail(account) && !checkMobile(phoneAccount)){
            document.getElementById("alipay_error_tips").innerHTML = get$("alipayrecharge2");
            return;
        }
    }
    if(money=="" ){
        document.getElementById("alipay_error_tips").innerHTML = get$("pleaseenteramount");
        return;
    }else {
        document.getElementById("alipay_error_tips").innerHTML = "&nbsp;";
    }
    if(money<100 || isNaN(money)){
        document.getElementById("alipay_error_tips").innerHTML=minimum1000;
        return;
    }
    if(money > 5000){
        document.getElementById("alipay_error_tips").innerHTML= get$("alipayrecharge3");
        return;
    }
    if(money.toString().indexOf(".")!=-1){
        money = money.toString().split(".")[0];
        money = money+(random.substring(1));
    }else{
        money = money+(random.substring(1));
    }

    var url = "/account/alipayRechargePre.do?random="+Math.round(Math.random()*100);
    var param={realName:realName,country:country,idNumber:idNumber,account:account,phoneAccount:phoneAccount,money:money,type:type};
    jQuery.post(url,param,function(data){
        var resultCode = data.result_code;
        if(resultCode == -1){
            document.getElementById("alipay_error_tips").innerHTML="充值金额小于100";
        }else if(resultCode == -2){
            okcoinAlert("充值金额不正确","",null);
        }else if(resultCode > 0){
            if(data.alipay_qr_account=="" || data.alipay_qr_account==null) {
                // 未获得支付宝充值目标账号
                document.getElementById("alipay_error_tips").innerHTML=get$("alipayrecharge15");
                //okcoinAlert(get$("alipayrecharge15"), "", null);
            }else{
                document.getElementById("alipay_money").value = "";
                document.getElementById("pay_amount").innerHTML = money;
                showAlipayRechargeblock('alipayRecharge',3);
                showTips(get$("alipayrecharge4"));
                document.getElementById("qr_code_pop_alipay").setAttribute("src",data.alipay_qr_path);
                document.getElementById("span_alipay_account").innerHTML = data.alipay_qr_account;
                document.getElementById("span_alipay_account_name").innerHTML = data.alipay_qr_account_name;
            }
            refTenbody(type);
        }else if(resultCode == -3){
            okcoinAlert(remarkbeenused,"",null);
        }else if(resultCode == -4){
            document.getElementById("alipay_error_tips").innerHTML="邮箱格式不正确";
        }else if(resultCode == -5){
            window.location.href = "/";
        }else if(resultCode == -6){
            document.getElementById("alipay_error_tips").innerHTML="手机号格式不正确";
        }else if(resultCode == -100056){
            okcoinAlert(get$("rechargecountrylimit"),"",null);
        }else if(resultCode == -10106){
            document.getElementById("alipay_error_tips").innerHTML="手机支付宝账户已经被绑定";
        }else if(resultCode == -100){
            okcoinAlert("更新数据失败","",null);
        }else if(resultCode<-100){
            resultCode = resultCode+100;
            if(resultCode == -1){
                window.location.href = "/";
            }else if(resultCode == -2){
                okcoinAlert(get$("alipayrecharge7"),"",null);
            }else if(resultCode == -3 || resultCode == -4){
                okcoinAlert(get$("alipayrecharge8"),"",null);
            }else if(resultCode == -5){
                okcoinAlert(get$("alipayrecharge9"),"",null);
            }else if(resultCode == -6){
                //okcoinAlert(account + get$("alipayrecharge5"),"",null);
                document.getElementById("alipay_error_tips").innerHTML=account + get$("alipayrecharge5");
            }else if(resultCode == -7 || resultCode == -8){
                okcoinAlert(get$("alipayrecharge10"),"",null);
            }else if(resultCode == -9){
                okcoinAlert(get$("alipayrecharge11"),"",null);
            }else if(resultCode == -10){
                okcoinAlert(get$("alipayrecharge2"),"",null);
            }else if(resultCode == -52){
                document.getElementById("alipay_error_tips").innerHTML="超过认证次数限制";
			}else if(resultCode == -35){
                document.getElementById("alipay_error_tips").innerHTML="身份证号不合法";
            }else if(resultCode == -36){
                document.getElementById("alipay_error_tips").innerHTML="身份证号无效";
            }else if(resultCode == -37){
                document.getElementById("alipay_error_tips").innerHTML="身份证号已被使用";
            }else if(resultCode == -51){
                document.getElementById("alipay_error_tips").innerHTML="身份证号与姓名不匹配";
            }else if(resultCode == -33){
                document.getElementById("alipay_error_tips").innerHTML="出生日期不合法";
            }else if(resultCode == -48){
                document.getElementById("alipay_error_tips").innerHTML="国籍限制";
            }else{
                okcoinAlert(get$("alipayrecharge6"),"",null);
            }
        }
    },"json");

}

//快速充值－新
var getResult;

function closeQuickRechargePop(){
    jQuery("#quickRecharge").hide();
    jQuery("#quick_charge_content").hide();
    jQuery("#quick_charge_success").hide();
    document.getElementById("qr_code_pop").innerHTML = "";
    clearInterval(getResult);
    dialogBoxHidden();
    window.location.reload();
}

function getQuickRechargeResultCode(orderId,money,companyType){
    var url = "/account/queryRechargeStatus.do?random="+Math.round(Math.random()*100);
    var param={orderId:orderId};
    getResult = setInterval(function () {
        jQuery.post(url,param,function(data){
            var style = data.errorCode;
            var isSuccess = data.isSuccess;
            if(style==0){
            	if(isSuccess){
                    jQuery("#quickRecharge").show();
                    jQuery("#quick_charge_content").hide();
                    jQuery("#quick_charge_success").show();
                    dialogBoxHidden()
                    if (companyType == 120) {
                        document.getElementById("arrive_amount").innerHTML = MathKit.Mul(money, 0.9955, 2);
                    }
                    if (companyType == 119) {
                        document.getElementById("arrive_amount").innerHTML = MathKit.Mul(money, 0.994, 2);
                    }
                    setTimeout("closeQuickRechargePop()",3000);
                    document.getElementById("qr_code_pop").innerHTML = "";
                    clearInterval(getResult);
				}
            }else{
                getQuickRechargeResultCode(orderId,money,companyType);
            }
        });
    },2000);

    var clearAllInterval = setTimeout(function () {
        clearInterval(getResult);
        closeQuickRechargePop();
    },10*60*1000);

}

function quickChargeNew(companyType,str){
	if(str==0) {
        //时间控件
        validDateIpt("#birthDate");

        //姓
        var realName = document.getElementById("realName").value;
        if (realName == "") {
            document.getElementById("quickTips").innerHTML = get$("notEmptyRealName");//真是姓名
            return;
        }
        if (realName.length >= 100) {
            document.getElementById("quickTips").innerHTML = "姓名过长.";//get$("foreignIdentityfirstnameislong");
            return;
        }

        //国籍
        var country = document.getElementById("country").value;
        //出生日期
        var birthDate = document.getElementById("birthDate").value;
        //地点
        var verifyType = 0;
        if (document.getElementById("personalVerifyPosition")) {
            verifyType = document.getElementById("personalVerifyPosition").value;
        }

        if (country == "40") {//国内用户
            //身份证号
            var idNumber = trim(document.getElementById("idNumber").value);
            if (idNumber == "") {
                document.getElementById("quickTips").innerHTML = get$("notEmptyIdNumber");
                return;
            } else {
                document.getElementById("quickTips").innerHTML = "&nbsp;";
            }
            if (idNumber.length <= 5) {
                document.getElementById("quickTips").innerHTML = get$("wrongidnumber");
                return;
            }
            if (idNumber.length >= 20) {
                document.getElementById("quickTips").innerHTML = get$("wrongidnumber");
                return;
            }
            if (!identityCheck(idNumber)) {
                document.getElementById("quickTips").innerHTML = get$("wrongidnumber");
                return;
            }
        } else {
            //护照号
            var passport = trim(document.getElementById("passport").value);
            if (passport == "") {
                document.getElementById("quickTips").innerHTML = get$("entryPassportNum");
                return;
            } else {
                document.getElementById("quickTips").innerHTML = "&nbsp;";
            }
            if (passport.length <= 5) {
                document.getElementById("quickTips").innerHTML = get$("wrongpassportnumber");
                return;
            }
            if (passport.length >= 20) {
                document.getElementById("quickTips").innerHTML = get$("wrongpassportnumber");
                return;
            }
            // 身份证用户不用选择生日，护照用户需要
            if (birthDate == "") {
                document.getElementById("quickTips").innerHTML = get$("notEmptyBirthday");
                return;
            }
        }
    }else{
		var realName = "";
		var country = "";
		var idNumber = "";
	}

    var type = document.getElementById("finType").value;
    var money = document.getElementById("transferAmount").value;
    if(money=="" ){
        document.getElementById("quickTips").innerHTML = "请填写充值金额！";
        return;
    }else {
        document.getElementById("quickTips").innerHTML = "&nbsp;";
    }
    if(money<100 || isNaN(money)){
        document.getElementById("quickTips").innerHTML = minimum1000;
        return;
    }
    if(money > 5000){
        document.getElementById("quickTips").innerHTML= get$("alipayrecharge3");
        return;
    }

    var regeditValue = document.getElementById("submitQuickChargeNew").value;		//先前按钮的值
    waitingStation("submitQuickChargeNew",regeditValue);
    var url = "/account/quickRechargeSubmit.do?random="+Math.round(Math.random()*100);
    var param={realName:realName,country:country,idNumber:idNumber,money:money,companyType:companyType};
    jQuery.post(url,param,function(data){
        var resultCode = data.result;
        if(resultCode == -2){
            okcoinAlert(completeinformation,"",null);
        }else if(resultCode == 0){
            document.getElementById("pay_amount_quick").innerHTML = money;
            if (companyType == 120) {
                document.getElementById("pay_amount_arrive").innerHTML = MathKit.Mul(money, 0.9955, 2);
            }
            if (companyType == 119) {
                document.getElementById("pay_amount_arrive").innerHTML = MathKit.Mul(money, 0.994, 2);
			}

            if(navigator.userAgent.indexOf("MSIE")>0) {
                jQuery('#qr_code_pop').qrcode({text:data.url,width:"190",height:"190",render:"table"});
            } else{
                jQuery('#qr_code_pop').qrcode({text:data.url,width:"190",height:"190"});
            }

            jQuery("#quickRecharge").show();
            jQuery("#quick_charge_content").show();
            jQuery("#quick_charge_success").hide();
            dialogBoxShadow();
            getQuickRechargeResultCode(data.orderId,money,companyType);
            cancelWaiting("submitQuickChargeNew",regeditValue);
            refTenbody(type);
        }else if(resultCode == -3){
            okcoinAlert(remarkbeenused,"",null);
        }else if(resultCode == -4){
            document.getElementById("alipay_error_tips").innerHTML=account + get$("alipayrecharge5");
        }else if(resultCode == -5){
            window.location.href = "/";
        }else if(resultCode == -8){
            document.getElementById("quickTips").innerHTML="每日充值最高限额5000元，请使用网银充值渠道充值。";
        }else if(resultCode == -100056){
            okcoinAlert(get$("rechargecountrylimit"),"",null);
        }else if(resultCode == -100){
            okcoinAlert("更新数据失败","",null);
        }else if (resultCode == 100){
            okcoinAlert(get$("depositfailedcontact"),"",null);
        }else if(resultCode<-100){
            resultCode = resultCode+100;
            if(resultCode == -1){
                window.location.href = "/";
            }else if(resultCode == -2){
                okcoinAlert(get$("alipayrecharge7"),"",null);
            }else if(resultCode == -3 || resultCode == -4){
                okcoinAlert(get$("alipayrecharge8"),"",null);
            }else if(resultCode == -5){
                okcoinAlert(get$("alipayrecharge9"),"",null);
            }else if(resultCode == -6){
                document.getElementById("alipay_error_tips").innerHTML=account + get$("alipayrecharge5");
            }else if(resultCode == -7){
                okcoinAlert(get$("alipayrecharge10"),"",null);
            }else if(resultCode==-8){
                okcoinAlert("每日充值最高限额5000元，请使用网银充值渠道充值。");
            }else if(resultCode == -9){
                okcoinAlert(get$("alipayrecharge11"),"",null);
            }else if(resultCode == -10){
                okcoinAlert(get$("alipayrecharge2"),"",null);
            }else if(resultCode == -52){
                document.getElementById("quickTips").innerHTML="超过认证次数限制";
            }else if(resultCode == -35){
                document.getElementById("quickTips").innerHTML="身份证号不合法";
            }else if(resultCode == -36){
                document.getElementById("quickTips").innerHTML="身份证号无效";
            }else if(resultCode == -37){
                document.getElementById("quickTips").innerHTML="身份证号已被使用";
            }else if(resultCode == -51){
                document.getElementById("quickTips").innerHTML="身份证号与姓名不匹配";
            }else if(resultCode == -33){
                document.getElementById("quickTips").innerHTML="出生日期不合法";
            }else if(resultCode == -48){
                document.getElementById("quickTips").innerHTML="国籍限制";
            }else{
                okcoinAlert(get$("alipayrecharge6"),"",null);
            }
        }
        cancelWaiting("submitQuickChargeNew",regeditValue);
    },"json");

}

// 绑定充值地址
function submitRechargeCnyAddress(){
	// 获得参数
	var bankId = document.getElementById("openBankId").value;// 开户银行
	var rechargeAccount = trim(document.getElementById("rechargeAccount").value);// 银行账号
    if(document.getElementById("openBankAccount")) {
        rechargeAccount = document.getElementById("openBankAccount").value;
    }

	if(bankId < 0){
		document.getElementById("addrMsgSpan").innerHTML = get$("notselectbank");
		return;
	}else{
		document.getElementById("addrMsgSpan").innerHTML = "&nbsp;";
	}
	if(rechargeAccount == "" || rechargeAccount.length>200){
		document.getElementById("addrMsgSpan").innerHTML = get$("accountnumberisnotvalids");
		return;
	}else{
		document.getElementById("addrMsgSpan").innerHTML = "&nbsp;";
	}
	//卡号验证（只能是数字,注意得先去掉）
	var regAccount = /^\d+$/g;
	if(!regAccount.test(rechargeAccount.replace(/\s/g, "")) ){
		document.getElementById("addrMsgSpan").innerHTML = get$("entervalidaccountnumber");
		return;
	}else{
		document.getElementById("addrMsgSpan").innerHTML = "&nbsp;";
	}
	var accountNumber = rechargeAccount.replace(/\s/g, "");
	if(accountNumber.length < 8 || accountNumber.length > 25){
		document.getElementById("addrMsgSpan").innerHTML = get$("entervalidaccountnumber");
		return;
	}else{
		document.getElementById("addrMsgSpan").innerHTML = "&nbsp;";
	}
    if(document.getElementById("reRechargeAccount")) {
        var reRechargeAccount = trim(document.getElementById("reRechargeAccount").value);// 确认银行账号
        if(rechargeAccount != reRechargeAccount){
            document.getElementById("addrMsgSpan").innerHTML = get$("accountnumberconfirmationdoesnotmatch");
            return;
        }else{
            document.getElementById("addrMsgSpan").innerHTML = "&nbsp;";
        }
    }

    var type = 1;// 银行账户类型 1、个人户 3、企业户
    var accountProvince,accountCity,subBankName;
    if(document.getElementById("accountType")){
        type = document.getElementById("accountType").value;
    }
    // 企业账户需要填写其它信息
    if(type==3) {
        accountProvince = jQuery("#accountProvince").attr("codeValue");
        accountCity = jQuery("#accountCity").attr("codeValue");
        subBankName = trim(document.getElementById("subBankName").value);

        if(accountProvince <= 0){
            document.getElementById("addrMsgSpan").innerHTML = get$("depositbankprovinceillegal");
            return;
        }else{
            document.getElementById("addrMsgSpan").innerHTML = "&nbsp;";
        }
        if(accountCity <= 0){
            document.getElementById("addrMsgSpan").innerHTML = get$("depositbankcityillegal");
            return;
        }else{
            document.getElementById("addrMsgSpan").innerHTML = "&nbsp;";
        }
        if(subBankName == "" || subBankName.length>200){
            document.getElementById("addrMsgSpan").innerHTML = get$("subbanknameillegal");
            return;
        }else{
            document.getElementById("addrMsgSpan").innerHTML = "&nbsp;";
        }
    }
	
	// 校验银行卡总数
	var total = document.getElementById("cardTotal").value;
	if(total >= 5){
		document.getElementById("addrMsgSpan").innerHTML = get$("onlycanadd5bankaccounts");
		return;
	}else{
		document.getElementById("addrMsgSpan").innerHTML = "&nbsp;";
	}

	// 置灰按钮
	//document.getElementById("submitAddressButton").disabled = true;
	var buttonValue = document.getElementById("submitAddressButton").value;		//先前按钮的值
	waitingStation("submitAddressButton",get$("insubmiting"));

	var url = "/account/submitRechargeCnyAddress.do?random="+Math.round(Math.random()*100);
	var param={type:type,bankId:bankId,rechargeAccount:rechargeAccount,accountProvince:accountProvince,accountCity:accountCity,subBankName:subBankName};
	jQuery.post(url,param,function(data){
		var result = eval('(' + data + ')');
		if(result!=null){
			 if(result.resultCode == 0){
                 if(document.getElementById("openBankAccount")) {
                     // 绑定成功，然后提交充值单
                     jQuery("#bankBindedSel").attr("addressValue",result.addressId);
                     jQuery("#bankBindedSel").attr("codeValue",result.bankId);
                     createOrder(0);
                 }else{
                     // 绑定成功，1秒后刷新页面
                     document.getElementById("addrMsgSpan").innerHTML = get$("bindaccountnumbersucceed");
                 }
				 setTimeout("location.reload([true]) ",1000);
			 }else if(result.resultCode == getErrorNum("not_bind_identity")){
				 document.getElementById("addrMsgSpan").innerHTML = get$("bindaccountmustbindidentity");
			 }else if(result.resultCode == getErrorNum("recharge_address_illegal")){
				 document.getElementById("addrMsgSpan").innerHTML = get$("pleaseselectbankaccount");
			 }else if(result.resultCode == getErrorNum("recharge_address_corract")){
				 document.getElementById("addrMsgSpan").innerHTML=get$("entercorractaccount");
			 }else if(result.resultCode == getErrorNum("recharge_bank_illegal")){
				 document.getElementById("addrMsgSpan").innerHTML = selectbanktype;
			 }else if(result.resultCode == getErrorNum("recharge_address_be_bind")){
				 document.getElementById("addrMsgSpan").innerHTML = rechargeAccount + get$("accountmusthasexisted");
			 }else if(result.resultCode == getErrorNum("recharge_address_count_too_much")){
				 document.getElementById("addrMsgSpan").innerHTML = get$("haveadded5bankaccounts");
			 }else if(result.resultCode == getErrorNum("withdraw_payee_illegal")){
                 document.getElementById("addrMsgSpan").innerHTML = get$("payeeillegal");
             }else if(result.resultCode == getErrorNum("withdraw_address_company_province_illegal")){
                 document.getElementById("addrMsgSpan").innerHTML = get$("depositbankprovinceillegal");
             }else if(result.resultCode == getErrorNum("withdraw_address_company_city_illegal")){
                 document.getElementById("addrMsgSpan").innerHTML = get$("depositbankcityillegal");
             }else if(result.resultCode == getErrorNum("withdraw_address_company_subbank_name_illegal")){
                 document.getElementById("addrMsgSpan").innerHTML = get$("subbanknameillegal");
             }else if(result.resultCode == getErrorNum("recharge_address_master_not_match")){
                 document.getElementById("addrMsgSpan").innerHTML = "银行卡开户人与姓名不符";
             }else if(result.resultCode == getErrorNum("recharge_address_times_limits")){
                 document.getElementById("addrMsgSpan").innerHTML = "每天限制绑定5次银行卡";
             }else if(result.resultCode == getErrorNum("recharge_address_time_out")){
                 document.getElementById("addrMsgSpan").innerHTML = "绑定银行卡超时，请重试";
             }else{
				 document.getElementById("addrMsgSpan").innerHTML = get$("bindaccountnumberfailed");
			 }
			 
		}
		cancelWaiting("submitAddressButton",buttonValue);
		//document.getElementById("submitAddressButton").disabled = false;
	});	
}

// 绑定充值地址然后提交充值单
function submitRechargeCnyAddressAndFin(){
    // 获得参数
    var bankId = jQuery("#openBank").attr("codeValue");// 开户银行
    var rechargeAccount = trim(document.getElementById("openBankAccount").value);// 银行账号

    if(bankId < 0){
        document.getElementById("finTigs").innerHTML = get$("notselectbank");
        return;
    }else{
        document.getElementById("finTigs").innerHTML = "&nbsp;";
    }
    if(rechargeAccount == ""){
        document.getElementById("finTigs").innerHTML = "请输入银行卡号";
        return;
    }else if(rechargeAccount.length>200){
        document.getElementById("finTigs").innerHTML = get$("accountnumberisnotvalid");
        return;
	}else{
        document.getElementById("finTigs").innerHTML = "&nbsp;";
    }
    //卡号验证（只能是数字,注意得先去掉）
    var regAccount = /^\d+$/g;
    if(!regAccount.test(rechargeAccount.replace(/\s/g, "")) ){
        document.getElementById("finTigs").innerHTML = get$("entervalidaccountnumber");
        return;
    }else{
        document.getElementById("finTigs").innerHTML = "&nbsp;";
    }
    var accountNumber = rechargeAccount.replace(/\s/g, "");
    if(accountNumber.length < 8 || accountNumber.length > 25){
        document.getElementById("finTigs").innerHTML = get$("entervalidaccountnumber");
        return;
    }else{
        document.getElementById("finTigs").innerHTML = "&nbsp;";
    }
	//点击按钮后让其置灰不可点并出现动态小点点
    var regeditValue = document.getElementById("bindBankCard").value;		//先前按钮的值
    waitingStation("bindBankCard",regeditValue);
    var type = 1;// 银行账户类型 1、个人户 3、企业户
    var url = "/account/submitRechargeCnyAddress.do?random="+Math.round(Math.random()*100);
    var param={type:type,bankId:bankId,rechargeAccount:rechargeAccount};
    jQuery.post(url,param,function(data){
        var result = eval('(' + data + ')');
        if(result!=null){
            if(result.resultCode == 0){
                // 绑定成功，然后提交充值单
                jQuery("#bankBindedSel").attr("addressValue",result.addressId);
                jQuery("#bankBindedSel").attr("codeValue",result.bankId);
                document.getElementById("finTigs").innerHTML = "绑定成功";
                window.location.reload();
                //createOrder(0);
            }else if(result.resultCode == getErrorNum("not_bind_identity")){
                document.getElementById("finTigs").innerHTML = get$("bindaccountmustbindidentity");
            }else if(result.resultCode == getErrorNum("recharge_address_illegal")){
                document.getElementById("finTigs").innerHTML = get$("pleaseselectbankaccount");
            }else if(result.resultCode == getErrorNum("recharge_address_corract")){
                document.getElementById("finTigs").innerHTML=get$("entercorractaccount");
            }else if(result.resultCode == getErrorNum("recharge_bank_illegal")){
                document.getElementById("finTigs").innerHTML = selectbanktype;
            }else if(result.resultCode == getErrorNum("recharge_address_be_bind")){
                // 重复绑定
                jQuery("#bankBindedSel").attr("addressValue",result.addressId);
                jQuery("#bankBindedSel").attr("codeValue",result.bankId);
                window.location.reload();
                createOrder(0);
            }else if(result.resultCode == getErrorNum("recharge_address_count_too_much")){
                document.getElementById("finTigs").innerHTML = get$("haveadded5bankaccounts");
            }else if(result.resultCode == getErrorNum("withdraw_payee_illegal")){
                document.getElementById("finTigs").innerHTML = get$("payeeillegal");
            }else if(result.resultCode == getErrorNum("withdraw_address_company_province_illegal")){
                document.getElementById("finTigs").innerHTML = get$("depositbankprovinceillegal");
            }else if(result.resultCode == getErrorNum("withdraw_address_company_city_illegal")){
                document.getElementById("finTigs").innerHTML = get$("depositbankcityillegal");
            }else if(result.resultCode == getErrorNum("withdraw_address_company_subbank_name_illegal")){
                document.getElementById("finTigs").innerHTML = get$("subbanknameillegal");
            }else if(result.resultCode == getErrorNum("recharge_address_master_not_match")){
                document.getElementById("finTigs").innerHTML = "银行卡开户人与姓名不符";
            }else if(result.resultCode == getErrorNum("recharge_address_times_limits")){
                document.getElementById("finTigs").innerHTML = "每天限制绑定3次银行卡";
            }else{
                document.getElementById("finTigs").innerHTML = get$("bindaccountnumberfailed");
            }
        }
        cancelWaiting("bindBankCard",regeditValue);
    });
}

/**
 * 时间验证
 */
function validDateIpt(dateName) {
    jQuery(dateName).val("");
    var box = jQuery(dateName).parent().find(".dateinput_box");
    var year = jQuery(box).find(".year_value").val();
    var month = jQuery(box).find(".month_value").val();
    var dvalue = jQuery(box).find(".day_value").val();
    if(year!=""&&month!="") {
        var days = new Date(year,month,0).getDate();
        for(var i=1;i<=days;++i) {
            if(dvalue==i) {
                month = month.length>1 ? month : "0"+month;
                dvalue = dvalue.length>1 ? dvalue : "0"+dvalue;
                jQuery(dateName).val(year+"-"+month+"-"+dvalue);
                return;
            }
        }
    }
}

// 认证个人身份并绑定银行卡
function verifyIdentityBindBankCard(){

    validDateIpt("#birthDate");

    //姓
    var realName = document.getElementById("realName").value;
    if(realName == ""){
        document.getElementById("finTigs").innerHTML = get$("notEmptyRealName");//真是姓名
        return;
    }
    if(realName.length >= 100){
        document.getElementById("finTigs").innerHTML = "姓名过长.";//get$("foreignIdentityfirstnameislong");
        return;
    }

    //国籍
    var country = document.getElementById("country").value;
    //出生日期
    var birthDate = document.getElementById("birthDate").value;
    //地点
    var verifyType = 0;
    if(document.getElementById("personalVerifyPosition")){
        verifyType = document.getElementById("personalVerifyPosition").value;
    }

    if(country=="40"){//国内用户
        //身份证号
        var idNumber = trim(document.getElementById("idNumber").value);
        if(idNumber == ""){
            document.getElementById("finTigs").innerHTML = get$("notEmptyIdNumber");
            return;
        }else{
            document.getElementById("finTigs").innerHTML = "&nbsp;";
        }
        if(idNumber.length <= 5){
            document.getElementById("finTigs").innerHTML = get$("wrongidnumber");
            return;
        }
        if(idNumber.length >= 20){
            document.getElementById("finTigs").innerHTML = get$("wrongidnumber");
            return;
        }
        if(!identityCheck(idNumber)){
            document.getElementById("finTigs").innerHTML = get$("wrongidnumber");
            return;
        }
    }else{
        //护照号
        var passport = trim(document.getElementById("passport").value);
        if(passport == ""){
            document.getElementById("finTigs").innerHTML = get$("entryPassportNum");
            return;
        }else{
            document.getElementById("finTigs").innerHTML = "&nbsp;";
        }
        if(passport.length <= 5){
            document.getElementById("finTigs").innerHTML = get$("wrongpassportnumber");
            return;
        }
        if(passport.length >= 20){
            document.getElementById("finTigs").innerHTML = get$("wrongpassportnumber");
            return;
        }
        // 身份证用户不用选择生日，护照用户需要
        if(birthDate == ""){
            document.getElementById("finTigs").innerHTML = get$("notEmptyBirthday");
            return;
        }
    }

    // 获得参数
    var bankId = jQuery("#openBank").attr("codeValue");// 开户银行
    var rechargeAccount = trim(document.getElementById("openBankAccount").value);// 银行账号

    if(bankId < 0){
        document.getElementById("finTigs").innerHTML = get$("notselectbank");
        return;
    }else{
        document.getElementById("finTigs").innerHTML = "&nbsp;";
    }
    if(rechargeAccount == "" ){
        document.getElementById("finTigs").innerHTML = "请输入银行卡号";
        return;
    }else if(rechargeAccount.length>200){
        document.getElementById("finTigs").innerHTML = get$("accountnumberisnotvalid");
        return;
	}else{
        document.getElementById("finTigs").innerHTML = "&nbsp;";
    }
    //卡号验证（只能是数字,注意得先去掉）
    var regAccount = /^\d+$/g;
    if(!regAccount.test(rechargeAccount.replace(/\s/g, "")) ){
        document.getElementById("finTigs").innerHTML = get$("entervalidaccountnumber");
        return;
    }else{
        document.getElementById("finTigs").innerHTML = "&nbsp;";
    }
    var accountNumber = rechargeAccount.replace(/\s/g, "");
    if(accountNumber.length < 8 || accountNumber.length > 25){
        document.getElementById("finTigs").innerHTML = get$("entervalidaccountnumber");
        return;
    }else{
        document.getElementById("finTigs").innerHTML = "&nbsp;";
    }

	//点击按钮后让其置灰不可点并出现动态小点点
    var regeditValue = document.getElementById("bindBankCard").value;		//先前按钮的值
    waitingStation("bindBankCard",regeditValue);
    var type = 1;// 银行账户类型 1、个人户 3、企业户
    var url = "/account/submitRechargeCnyAddress.do?random="+Math.round(Math.random()*100);
    var param={realName:realName,country:country,idNumber:idNumber,type:type,bankId:bankId,rechargeAccount:rechargeAccount};
    jQuery.post(url,param,function(data){
        var result = eval('(' + data + ')');
        if(result!=null){
            if(result.resultCode == 0){
                // 绑定成功，刷新页面
                window.location.reload();
            }else if(result.resultCode == getErrorNum("not_bind_identity")){
                document.getElementById("finTigs").innerHTML = get$("bindaccountmustbindidentity");
            }else if(result.resultCode == getErrorNum("recharge_address_illegal")){
                document.getElementById("finTigs").innerHTML = get$("pleaseselectbankaccount");
            }else if(result.resultCode == getErrorNum("recharge_address_corract")){
                document.getElementById("finTigs").innerHTML=get$("entercorractaccount");
            }else if(result.resultCode == getErrorNum("recharge_bank_illegal")){
                document.getElementById("finTigs").innerHTML = selectbanktype;
            }else if(result.resultCode == getErrorNum("recharge_address_be_bind")){
                // 重复绑定
                jQuery("#bankBindedSel").attr("addressValue",result.addressId);
                jQuery("#bankBindedSel").attr("codeValue",result.bankId);
                window.location.reload();
                //createOrder(0);
            }else if(result.resultCode == getErrorNum("recharge_address_count_too_much")){
                document.getElementById("finTigs").innerHTML = get$("haveadded5bankaccounts");
            }else if(result.resultCode == getErrorNum("withdraw_payee_illegal")){
                document.getElementById("finTigs").innerHTML = get$("payeeillegal");
            }else if(result.resultCode == getErrorNum("withdraw_address_company_province_illegal")){
                document.getElementById("finTigs").innerHTML = get$("depositbankprovinceillegal");
            }else if(result.resultCode == getErrorNum("withdraw_address_company_city_illegal")){
                document.getElementById("finTigs").innerHTML = get$("depositbankcityillegal");
            }else if(result.resultCode == getErrorNum("withdraw_address_company_subbank_name_illegal")){
                document.getElementById("finTigs").innerHTML = get$("subbanknameillegal");
            }else if(result.resultCode == getErrorNum("recharge_address_master_not_match")){
                document.getElementById("finTigs").innerHTML = "银行卡开户人与姓名或身份证号不符";
            }else if(result.resultCode == getErrorNum("recharge_address_times_limits")){
                document.getElementById("finTigs").innerHTML = "每天限制绑定3次银行卡";
            }else if(result.resultCode == 152){
                document.getElementById("finTigs").innerHTML = "超过认证次数限制";
            }else if(result.resultCode == 135){
                document.getElementById("finTigs").innerHTML = "身份证号不合法";
            }else if(result.resultCode == 136){
                document.getElementById("finTigs").innerHTML = "身份证号无效";
            }else if(result.resultCode == 137){
                document.getElementById("finTigs").innerHTML = "身份证号已被使用";
            }else if(result.resultCode == 151){
                document.getElementById("finTigs").innerHTML = "身份证号与姓名不匹配";
            }else if(result.resultCode == 133){
                document.getElementById("finTigs").innerHTML = "出生日期不合法";
            }else if(result.resultCode == 148){
                document.getElementById("finTigs").innerHTML = "国籍限制";
            }else if(result.resultCode == 100){
                document.getElementById("finTigs").innerHTML = "更新数据失败";
            }else{
                document.getElementById("finTigs").innerHTML = get$("bindaccountnumberfailed");
            }
        }
        cancelWaiting("bindBankCard",regeditValue);
    });
}

// 删除绑定充值地址
function deleteRechargeCnyAddress(addressId){
	
	// 判断是否只有一个银行卡，若是则不能删除
	var total = document.getElementById("cardTotal").value;
	var legalAddressTotal = document.getElementById("legalAddressTotal");// 提现合法地址数量
	if(legalAddressTotal){
		total = legalAddressTotal.value;
	}
	
	// if(total <= 1){
	// 	return;
	// }
	
	if(addressId <= 0){
		return;
	}else{
		document.getElementById("addrMsgSpan").innerHTML = "&nbsp;";
	}
	
	// 移除元素
	jQuery("#addressDiv_"+addressId).remove();
	// 移除的银行卡被选中
	var selAdressId = jQuery("#bankBindedSel").attr("addressValue");
	if(selAdressId == addressId){
		// 顺延选择剩下的第一个银行卡
		var $li = jQuery("#ulFinCnyAddress").find("li").first();
		jQuery("#bankBindedSel").attr("addressValue",$li.attr("addressId"));
		jQuery("#bankBindedSel").attr("codeValue",$li.attr("code"));
		jQuery("#bankBindedSel").html($li.html());
	}
	
	total  = total - 1;
	document.getElementById("cardTotal").value = total;
	// 只剩一个银行卡时，隐藏所有的删除按钮
	// if(total <= 1){
	// 	jQuery(".delete").hide();
	// }
	
	var url = "/account/deleteRechargeCnyAddress.do?random="+Math.round(Math.random()*100);
	var param={addressId:addressId};
	jQuery.post(url,param,function(data){
		window.location.reload();
	});	
}

// 格式化显示银行账号
function onkeyupBankAccount(account){
	var banknumber = account.value.replace(/\D/g,'');
	account.value = plusSpace(banknumber);
}

//快捷充值
function createQuickOrder(){
	// 校验参数
    var finType = document.getElementById("finType").value;
	var amount = document.getElementById("transferAmount").value;
	if(amount==""){
		document.getElementById("quickTips").innerHTML="请输入充值金额";
		return ;
	}
	if(amount<100){
		document.getElementById("quickTips").innerHTML="最小充值金额为100元";
		return ;
	}
	if(amount>5000){
		document.getElementById("quickTips").innerHTML="最大充值金额为5000元";
		return ;
	}
	document.getElementById("quickTips").innerHTML="";
	
	var fee = amount * 0.002;
    if(finType==116){
        fee = amount * 0.003;
    }
    if(finType==119){
		fee = 0;
	}
	var actualAmount = amount - fee;
    var url = "/account/quickRechargeSubmit.do?random="+Math.round(Math.random()*100);
    var param={money:amount,companyType:finType};
    jQuery.post(url,param,function(data){
        var resultDate = eval('(' + data + ')');
        var result = -1;
        if(resultDate!=null){
            result = resultDate.result;
        }

        if(result==0){
            var orderId = resultDate.orderId;
            if(orderId!=null && orderId>0){
                var maoUrl = resultDate.maoUrl;
                var finButton = document.getElementById("jumpQuickLink");
                finButton.href=maoUrl;

				jQuery("#bank_cny_pop_title").html("快捷充值");
				jQuery("#jumpQuickBtn").html("前往网银支付");
				jQuery("#quickSubmitLi").show();
				jQuery("#beeCloudButton").hide();
				jQuery("#qrCode").hide();
				if(finType==119){
					jQuery("#bank_cny_pop_title").html("微信扫码充值");
					jQuery("#jumpQuickBtn").hide();
					jQuery("#beeCloudButton").hide();
					jQuery("#qrCode").attr("src",maoUrl);
					jQuery("#qrCode").show();
				}
                showQuickOrder(amount,fee,actualAmount,orderId,true);
                refTenbody(type);
            }
        }else if(result==-1){
            window.location.href=document.getElementById("coinMainUrl").value;
        }else if(result==-2){
            document.getElementById("quickTips").innerHTML="只允许进行了实名认证的用户使用快捷支付";
        }else if(result==-3 || result==-4){
            document.getElementById("quickTips").innerHTML="您输入的充值金额不合法";
        }else if(result==-5){
            document.getElementById("quickTips").innerHTML="最小充值金额为100元";
        }else if(result==-6){
            document.getElementById("quickTips").innerHTML="最大充值金额为2000元";
        }else if(result==-7){
            window.location.href=document.getElementById("coinMainUrl").value;
        }else if(result==-8){
            document.getElementById("quickTips").innerHTML="每日充值最高限额5000元，请使用网银充值渠道充值。";
        }else if(result==-100056){
            document.getElementById("quickTips").innerHTML="您所在的国家不支持充值";
        }else{
            window.location.reload();
        }

    });
}

// 显示订单信息，isfirst是否是此订单首次尝试充值
function showQuickOrder(amount,fee,actualAmount,orderId,isfirst){
	document.getElementById("quickChargeAccount").innerHTML=amount;
	document.getElementById("quickChargeFee").innerHTML=fee;
	document.getElementById("quickChargeArrival").innerHTML=actualAmount;
	document.getElementById("quickOrderId").value=orderId;
	
	if(isfirst){
        jQuery("#quickSubmitLi").show();
	}else{
        jQuery("#quickSubmitLi").hide();
	}
	
	dialogBoxShadow();
	jQuery("#quickRechargeCnyBlock").show();
	jQuery("#quickRechargeCnyBody").show();
	jQuery("#quickChargeOver").hide();
}

function closeQuickOrder(){
    window.location.reload();
}

// 计算汇付宝手续费
function countQuickFee(type){
	// 手续费，千分之二
	var amountInput = document.getElementById("transferAmount");
	checkNumberByObj(amountInput,1);
	if(amountInput.value==""){
		document.getElementById("quickTips").innerHTML="";
		document.getElementById("counterFee").innerHTML = "";
		document.getElementById("actualArrivalMoney").innerHTML = "";
	}else if(amountInput.value<100){
		document.getElementById("quickTips").innerHTML="最小充值金额为100元";
		document.getElementById("counterFee").innerHTML = "";
		document.getElementById("actualArrivalMoney").innerHTML = "";
	}else if(amountInput.value>5000){
		document.getElementById("quickTips").innerHTML="最大充值金额为5000元";
		document.getElementById("counterFee").innerHTML = "";
		document.getElementById("actualArrivalMoney").innerHTML = "";
	}else{
		var fee = 0;
        if (type == 119){
			fee = MathKit.Mul(amountInput.value, 0.006, 2);
		}
		if (type == 120) {
            fee = MathKit.Mul(amountInput.value, 0.0045, 2);
        }

		document.getElementById("quickTips").innerHTML="";
		document.getElementById("counterFee").innerHTML = fee;
		document.getElementById("actualArrivalMoney").innerHTML = amountInput.value-fee;
	}
}

/**
 * @tofishes js的四则精确运算方法
 * http://www.cnblogs.com/junjieok/p/3306155.html
 * 例如：
 * 268.34 + 0.83
 * 268.34 - 0.86
 * 0.3 - 0.2
 * 0.33 * 10
 * 33.3 / 10
 */
;(function (global) {

	function getDigits(num) {
		var digits = 0
			,   parts = num.toString().split(".");

		if (parts.length === 2) {
			digits = parts[1].length;
		}

		return digits;
	}

	function toFixed(num, digits) {
		if (typeof digits == 'undefined') {
			return num;
		}

		return Number(num).toFixed(digits);
	}

	var MathKit = {
		/*
		 函数，加法函数，用来得到精确的加法结果
		 说明：javascript的加法结果会有误差，在两个浮点数相加的时候会比较明显。这个函数返回较为精确的加法结果。
		 参数：arg1：第一个加数；arg2第二个加数；d要保留的小数位数（可以不传此参数，如果不传则不处理小数位数）
		 调用：MathKit.Add(arg1,arg2,d)
		 返回值：两数相加的结果
		 */
		Add: function (arg1, arg2, digits) {
			arg1 = arg1.toString(), arg2 = arg2.toString();

			var maxLen = Math.max(getDigits(arg1), getDigits(arg2))
				,   m = Math.pow(10, maxLen)
				,   result = Number(((arg1 * m + arg2 * m) / m).toFixed(maxLen));

			return toFixed(result, digits);
		},
		/*
		 函数：减法函数，用来得到精确的减法结果
		 说明：函数返回较为精确的减法结果。
		 参数：arg1：第一个加数；arg2第二个加数；d要保留的小数位数（可以不传此参数，如果不传则不处理小数位数
		 调用：MathKit.Sub(arg1,arg2)
		 返回值：两数相减的结果
		 */
		Sub: function (arg1, arg2, digits) {
			return MathKit.Add(arg1, -Number(arg2), digits);
		},
		/*
		 函数：乘法函数，用来得到精确的乘法结果
		 说明：函数返回较为精确的乘法结果。
		 参数：arg1：第一个乘数；arg2第二个乘数；d要保留的小数位数（可以不传此参数，如果不传则不处理小数位数)
		 调用：MathKit.Mul(arg1,arg2)
		 返回值：两数相乘的结果
		 */
		Mul: function (arg1, arg2, digits) {
			// 数字化
			var num1 = parseFloat(arg1).toString()
				,   num2 = parseFloat(arg2).toString()
				,   m = getDigits(num1) + getDigits(num2)

				,   result = num1.replace(".", "") * num2.replace(".", "") / Math.pow(10, m);

			return toFixed(result, digits);
		},
		/*
		 函数：除法函数，用来得到精确的除法结果
		 说明：函数返回较为精确的除法结果。
		 参数：arg1：除数；arg2被除数；d要保留的小数位数（可以不传此参数，如果不传则不处理小数位数)
		 调用：MathKit.Div(arg1,arg2)
		 返回值：arg1除于arg2的结果
		 */
		Div: function (arg1, arg2, digits) {
			// 数字化
			var num1 = parseFloat(arg1).toString()
				,   num2 = parseFloat(arg2).toString()

				,   t1 = getDigits(num1)
				,   t2 = getDigits(num2)

				,   result =  num1.replace(".", "") / num2.replace(".", "") * Math.pow(10, t2 - t1)

			return toFixed(result, digits);
		}
	};

	// AMD / RequireJS
	if (typeof define !== 'undefined' && define.amd) {
		define(function () {
			return MathKit;
		});
		return;
	};
	// Node.js
	if (typeof module !== 'undefined' && module.exports) {
		module.exports = MathKit;
		return;
	};

	global.MathKit = MathKit;
})(this);

/*// 获得猫钱包的链接
function getMaoBankLink(orderId){
	var url = "/account/getMaoBankLink.do?random="+Math.round(Math.random()*100);
	var param={orderId:orderId};
	jQuery.post(url,param,function(data){
		var resultDate = eval('(' + data + ')');
		var result = -1;
		if(resultDate!=null){
			result = resultDate.result;
		}
		
		if(result==0){
			var maoUrl = resultDate.maoUrl;
			if(maoUrl!=null && maoUrl!=""){
                var maoUrl = resultDate.maoUrl;
                var finButton = document.getElementById("jumpQuickLink");
                finButton.href=maoUrl;
			}
		}else{
			window.location.reload();
		}
		
	});
}*/

// 前往网银支付
function toMaoBank(){
    var finButton = document.getElementById("jumpQuickLink");
    finButton.target="_blank";
    if(finButton.href!=""){
        finButton.click();
        document.getElementById("quickRechargeCnyBody").style.display="none";
        document.getElementById("quickChargeOver").style.display="block";
    }
}

function createBeeCloudButtonPay() {
	// 校验参数
	var finType = document.getElementById("finType").value;
	if (finType != 118){
		return;
	}
	var amount = document.getElementById("transferAmount").value;
	if(amount==""){
		document.getElementById("quickTips").innerHTML="请输入充值金额";
		return ;
	}
	if(amount<100){
		document.getElementById("quickTips").innerHTML="最小充值金额为100元";
		return ;
	}
	if(amount>5000){
		document.getElementById("quickTips").innerHTML="最大充值金额为5000元";
		return ;
	}
	document.getElementById("quickTips").innerHTML="";

	var fee = amount * 0.004;
	var actualAmount = amount - fee;
	var url = "/account/beeCloudCnyRechargeSubmit.do?random="+Math.round(Math.random()*100);
	var param={money:amount,companyType:finType};
	jQuery.post(url,param,function(data){
		var result = -1;
		if(data != null){
			result = data.result;
		}

		if(result == 0){
			var orderId = data.orderId;
			if(orderId != null && orderId > 0){
				amount = amount * 100;
				jQuery("#jumpQuickLink").attr("href","/account/beeCloudButton.do?orderId=" + orderId + "&amount=" + amount + "&sign=" + data.sign);
				jQuery("#jumpQuickBtn").html("前往微信扫码支付");
				showQuickOrder(amount/100,fee,actualAmount,orderId,true);
				jQuery("#bank_cny_pop_title").html("微信扫码充值");
				refTenbody(type);
			}
		}else if(result==-1){
			window.location.href=document.getElementById("coinMainUrl").value;
		}else if(result==-2){
			document.getElementById("quickTips").innerHTML="只允许进行了实名认证的用户使用快捷支付";
		}else if(result==-3 || result==-4){
			document.getElementById("quickTips").innerHTML="您输入的充值金额不合法";
		}else if(result==-5){
			document.getElementById("quickTips").innerHTML="最小充值金额为100元";
		}else if(result==-6){
			document.getElementById("quickTips").innerHTML="最大充值金额为5000元";
		}else if(result==-7){
			window.location.href=document.getElementById("coinMainUrl").value;
		}else if(result==-8){
			document.getElementById("quickTips").innerHTML="每日充值最高限额5000元，请使用网银充值渠道充值。";
		}else{
			window.location.reload();
		}

	});
}

function showPersonalIdentityPop(){
	dialogBoxShadow();
	jQuery("#rechargeVerifyPop").show();
}

function hidePersonalIdentityPop(){
	dialogBoxHidden();
	jQuery("#rechargeVerifyPop").hide();
	//window.location.reload();
}


function checkBnakNumberMatching(bankNumberInput){
	var rechargeAccount = jQuery("#"+bankNumberInput).val();

    document.getElementById("openBankId").value = 0;
    document.getElementById("openBankName").innerText = "";

    if(rechargeAccount == ""){
        return;
    }else if(rechargeAccount.length>200){
        document.getElementById("finTigs").innerHTML = get$("accountnumberisnotvalid");
        return;
    }else{
        document.getElementById("finTigs").innerHTML = "&nbsp;";
    }
    //卡号验证（只能是数字,注意得先去掉）
    var regAccount = /^\d+$/g;
    if(!regAccount.test(rechargeAccount.replace(/\s/g, "")) ){
        document.getElementById("finTigs").innerHTML = get$("entervalidaccountnumber");
        return;
    }else{
        document.getElementById("finTigs").innerHTML = "&nbsp;";
    }
    var accountNumber = rechargeAccount.replace(/\s/g, "");
    if(accountNumber.length < 8 || accountNumber.length > 25){
        document.getElementById("finTigs").innerHTML = get$("entervalidaccountnumber");
        return;
    }else{
        document.getElementById("finTigs").innerHTML = "&nbsp;";
    }

	var url = "/account/getBankCardInfo.do?random="+Math.round(Math.random()*100);
	var param={account:accountNumber};
	jQuery.post(url,param,function(data) {
		var result = -1;
		if (data != null) {
			result = data.result;
		}

		if(result == 0){
			document.getElementById("openBankId").value = data.bankId;
			document.getElementById("openBankName").innerText = data.bankName;
		}else{
			if(result == -1){
                document.getElementById("openBankId").value = 0;
                document.getElementById("openBankName").innerText = "未知银行";
			}else{
				document.getElementById("finTigs").innerHTML = "银行卡查询失败";
			}
		}
	}, "json");
}

/**
 * 按钮点击后让其置灰不可点并出现动态小点点
 * @param elementId		对象id
 * @param elementValue	对象国际化值
 */
function waitingStation(elementId,elementValue){
//	alert(elementId);
	if(elementValue != "" && document.getElementById(elementId)){
		document.getElementById(elementId).value=elementValue;
		document.getElementById(elementId).style.background="#ebebeb";
		document.getElementById(elementId).style.color = "#686868";
		document.getElementById(elementId).style.cursor = "auto";
		document.getElementById(elementId).style.border = "1px solid #ebebeb";
		document.getElementById(elementId).disabled = true;
		circulatePoint(elementId,elementValue);
	}
}
/**
 * 按钮恢复可点击并去年动态小点点
 * @param elementId		对象id
 * @param elementValue	对象国际化值
 */
function cancelWaiting(elementId,elementValue){
	if(elementValue != "" && document.getElementById(elementId)){
		document.getElementById(elementId).value=elementValue;
		document.getElementById(elementId).style.background="#0096e0";
		document.getElementById(elementId).style.color = "#fff";
		document.getElementById(elementId).style.cursor = "pointer";
		document.getElementById(elementId).style.border = "1px solid #0096e0";
		document.getElementById(elementId).disabled = false;
		document.getElementById(elementId).value=elementValue;
		clearInterval(circulatePointTimer);
	}
}

/**
 * 控制按钮可点
 */
function checkSubmitStation() {
    var realName = jQuery("#realName").val();
    var idNumber = jQuery("#idNumber").val();
    var bankId = jQuery("#openBank").attr("codeValue");
    var openBankAccount = jQuery("#openBankAccount").val();
    if(realName!=null&&realName!=""&&idNumber!=null&&idNumber!=""&&bankId!=-1&&openBankAccount!=null&&openBankAccount!=""){
        jQuery("#bindBankCard").css({
            "background":"#0096df",
            "border":"1px solid #0096df"
        });
        document.getElementById("bindBankCard").disabled = false;
    }else {
        jQuery("#bindBankCard").css({
            "background":"#999",
            "border":"1px solid #999"
        });
        document.getElementById("bindBankCard").disabled = true;
    }
}

function checkSubmitStationBank() {
    var realName = jQuery("#realName").val();
    var idNumber = jQuery("#idNumber").val();
    var openBankAccount = jQuery("#openBankAccount").val();
    if(realName!=null&&realName!=""&&idNumber!=null&&idNumber!=""&&openBankAccount!=null&&openBankAccount!=""){
        jQuery("#bindBankCard").css({
            "background":"#0096df",
            "border":"1px solid #0096df"
        });
        document.getElementById("bindBankCard").disabled = false;
    }else {
        jQuery("#bindBankCard").css({
            "background":"#999",
            "border":"1px solid #999"
        });
        document.getElementById("bindBankCard").disabled = true;
    }
}
